home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / tcoop10a.zip / DOC.ZIP / STRING.DOC < prev    next >
Text File  |  1991-11-20  |  5KB  |  125 lines

  1. STRING.DOC      11/10/91        Copyright (c) 1991 by James S. Clark
  2. ==========================================================================
  3. STRING
  4. String Class
  5. --------------------------------------------------------------------------
  6. Class Name                      String
  7. Superclass                      <none>
  8. Category                        String
  9. Other classes referenced        <none>
  10. Other catagories referenced     <none>
  11. Used by                         ???
  12. Inherited by                    <none>
  13.  
  14. Declaration                     String  *s = new String;
  15. Instance Variables
  16.                                 int     len;
  17.                                 char    *str;
  18. Instance Methods
  19.                                 String  (char *);
  20.                                 String  (int);
  21.                                 String  ();
  22.                                 ~String ();
  23.  
  24.                                 int     length  ();
  25.                                 void    print   ();
  26.  
  27.                                 operator == (String& s);
  28.                                 operator == (char *s);
  29.                                 operator >  (String& s);
  30.                                 operator >  (char *s);
  31.                                 operator >= (String& s);
  32.                                 operator >= (char *s);
  33.                                 operator <  (String& s);
  34.                                 operator <  (char *s);
  35.                                 operator <= (String& s);
  36.                                 operator <= (char *s);
  37.  
  38.                                 String& operator =  (const String& s);
  39.                                 String& operator =  (const char *);
  40.                                 String& operator +  (const String& s);
  41.                                 String& operator +  (const char *);
  42.                                 String& operator += (const String& s);
  43.                                 String& operator += (const char *);
  44.                                 String& operator << (const String& s);
  45.                                 String& operator << (const char *);
  46.  
  47.                                 char&   operator [] (int index);
  48. --------------------------------------------------------------------------
  49. GENERAL DESCRIPTION
  50.  
  51. The String Class provides a number of operators for working strings.  The
  52. String Class has operations for comparing, concatenating, and testing
  53. string objects with other strings or standard character arrays.
  54.  
  55. --------------------------------------------------------------------------
  56. VARIABLES
  57.  
  58. int     len;
  59.         This variable holds the length of the string.
  60.  
  61. char    *str;
  62.         This is a pointer to the beginning of the string.
  63.  
  64. --------------------------------------------------------------------------
  65. METHODS
  66.  
  67. String  (char *);
  68.         This constructor creates a string and assigns a character array to
  69.         it.  Example:  String s("Text") assigns "Text" to string s.
  70.  
  71. String  (int);
  72.         This constructor creates a string with the size given as an integer.
  73.         For example:  String s(256) creates a string of 256 characters.
  74.  
  75. String  ();
  76.         This constructor creates a NULL string of size zero.  The value can
  77.         be assigned later.  Example:  String s;
  78.  
  79. ~String ();             // delete s;
  80.         String destructor method.
  81.  
  82. int     length  ();
  83.         Returns with the length of the string.
  84.  
  85. void    print   ();
  86.         Display the string, including a newline at the end.
  87.  
  88. operator == (String& s);        // equality
  89. operator == (char *s);
  90. operator >  (String& s);        // greater than
  91. operator >  (char *s);
  92. operator >= (String& s);        // greater than or equal
  93. operator >= (char *s);
  94. operator <  (String& s);        // less than
  95. operator <  (char *s);
  96. operator <= (String& s);        // less than or equal
  97. operator <= (char *s);
  98.         This group of operators allows equivalency testing of strings
  99.         and string, or string and character array.  They call the C
  100.         function strcmp().
  101.  
  102. String& operator =  (const String& s);          // copy
  103. String& operator =  (const char *);             // copy
  104.         These equal sign causes the contents of the string or character
  105.         array on the right hand side of the equals, to be copied into
  106.         the string on the left hand side of the equation.
  107.  
  108. String& operator +  (const String& s);          // concat
  109. String& operator +  (const char *);             // concat
  110. String& operator += (const String& s);          // concat
  111. String& operator += (const char *);             // concat
  112. String& operator << (const String& s);          // concat
  113. String& operator << (const char *);             // concat
  114.         These operators cause the string or character array on the right
  115.         side of the operation to be appended to the end of the string on
  116.         the left side of the operation.
  117.  
  118. char&   operator [] (int index);
  119.         This operator allows string indexing that conforms to the method
  120.         usually used in character arrays.
  121.  
  122. --------------------------------------------------------------------------
  123. STRING.DOC                      Copyright (c) 1991 by James S. Clark
  124. ==========================================================================
  125.